#    This file is part of OpenPolitik.
#
#    OpenPolitik is free software: you can redistribute it and/or modify
#    it under the terms of the GNU General Public License as published by
#    the Free Software Foundation, either version 3 of the License, or
#    (at your option) any later version.
#
#    OpenPolitik is distributed in the hope that it will be useful,
#    but WITHOUT ANY WARRANTY; without even the implied warranty of
#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#    GNU General Public License for more details.
#
#    You should have received a copy of the GNU General Public License
#    along with OpenPolitik.  If not, see <http://www.gnu.org/licenses/>.
import cgi
import wsgiref.handlers

from google.appengine.ext import webapp

import op_models
import op_controllers
import game_controller
import user_controller
import message_controller

def main():
	application = webapp.WSGIApplication([
		# probably want a more elegant way of handling this
			('/', op_controllers.MainPage),
			("/games", game_controller.GamesPage),
			("/game", game_controller.GamePage),
			("/prefs", op_controllers.Preferences),
			("/create_game", game_controller.CreateGame),
			("/start_game", game_controller.StartGame),
			("/join", game_controller.JoinGame),
			("/message", op_controllers.Message),
			("/message/(.*)", message_controller.ShowMessage),
			("/delete_message", message_controller.DeleteMessage),
			("/user/(.*)", user_controller.ShowUser),
			("/compose/(.*)", message_controller.Compose),
			("/send_reply", message_controller.Reply),
			("/boot", game_controller.Boot),
			("/orders", game_controller.Orders),
			("/get_orders", game_controller.AllOrders),
			("/update_info", game_controller.UpdateInfo),
			("/generate_map", game_controller.GenerateMap),
			("/view_map", game_controller.ViewMap),
			("/.*", op_controllers.Give404),
		], debug=True)
	wsgiref.handlers.CGIHandler().run(application)

if __name__ == "__main__":
	main()
